<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@page import="com.lmpop.frame.util.PageUtil"%>
<%@page import="com.lmpop.createIndex.search.MenuInfoIndexFiles"%>
<%@page import="com.lmpop.frame.util.PageTools"%>
<%@page import="com.lmpop.frame.dao.MenuInfo"%>
<%
	request.setCharacterEncoding("UTF-8");

	String _menu_name = "";
	if(request.getParameter("menu_name")!=null && !request.getParameter("menu_name").equals("")){
		_menu_name = new String(request.getParameter("menu_name").getBytes("ISO-8859-1"),"utf-8"); 
	}
	String cust_id = "";
	if( session.getAttribute("session_cust_id") != null ){
		cust_id = session.getAttribute("session_cust_id").toString();
	}
	
	MenuInfo menu = new MenuInfo();
	
	MenuInfoIndexFiles menuInfo=new MenuInfoIndexFiles();
	Map params=new Hashtable();
	params.put("menu_name",_menu_name);
	params.put("subsys_code","SYS");
	params.put("cust_id",cust_id);
	//params.put("menu_class","1");
	//out.print(params);
	List menuList=menuInfo.getMenuInfo(params);
	Map filterMap=new Hashtable();
	
%>
<html>
  <head>
    
    <title>帮助菜单列表</title>
	<link href="/program/admin/index/css/style.css" rel="stylesheet" type="text/css">
</head>

<body>
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td width="90%">
				<h1>帮助菜单列表</h1>
			</td>
			<td>
			</td>
		</tr>
	</table>
	
	<form action="index.jsp" name="indexForm" method="post">

	<table width="100%" cellpadding="0" cellspacing="0" border="0"  class="tablehe">
		<tr><td align="center"></td></tr>
	</table>
	
	<% 
		int menuListsize = 0;
		if(menuList!=null && menuList.size()>0){
			menuListsize = menuList.size();
	%>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="90%">
			</td>
			<td>
			</td>
		</tr>
	</table>
	
	<table width="100%" cellpadding="1" cellspacing="1" class="menuListtab" border="0">
		<tr>
			
		  	<th width="20%" style="font-size:14px;">菜单名称</th>
		  	<th width="20%" style="font-size:14px;">上一级菜单</th>
		  	<th style="font-size:14px;">说明</th>
		</tr>
		<% 
				List twoList=null,threeList=null;
		  		for(int i=0;i<menuListsize;i++){
		  			Hashtable map = (Hashtable)menuList.get(i);
		  			//out.print("map:"+map);
		  			String menu_id="",menu_name="",up_menu_id="",remark="";
		  			  	if(map.get("menu_id")!=null) menu_id = map.get("menu_id").toString();
						if(map.get("menu_name")!=null) menu_name = map.get("menu_name").toString();
						if(map.get("up_menu_id")!=null) up_menu_id = map.get("up_menu_id").toString();
						if(map.get("rsrv_str1")!=null) {
							remark = map.get("rsrv_str1").toString();
							if(remark!=null&&remark.length()>50)
								remark=remark.substring(0,50)+"...";
						}
						filterMap.put(menu_id,menu_name);
						String module_path = menu.getModuleFile(menu_id);
						module_path = module_path.replace("WebRoot/","");

				  %>
				
					
				 
						<tr style="line-height:20px;">
								<td width="20%">
								  		<%if(module_path==null||module_path.equals("")){%>
								  			<a href="#" >
								  		<%} else{%>
								  			<a href="<%=module_path%>?menu_id=<%=menu_id%>" target="main">
								  		<%}%>
									  	
									  	<%=menu_name%></a>
								  	</td>
						  	<td width="20%"><%=menuInfo.getMenuNameById(up_menu_id)%></td>
							<td ><%=remark %></td>
						</tr>
					
					
				
				  <%
				  			Map params1=new Hashtable();
							params1.put("subsys_code","SYS");
							params1.put("cust_id",cust_id);
							params1.put("up_menu_id",menu_id);
							params1.put("menu_class","2");
							twoList=menuInfo.getMenuInfo(params1);
							if(twoList!=null&&twoList.size()>0){
								for(int j=0;j<twoList.size();j++){
									Hashtable map1 = (Hashtable)twoList.get(j);
									//out.print("map1="+map1);
						  			String menu_id1="",menu_name1="",up_menu_id1="",remark1="";
						  			  	if(map1.get("menu_id")!=null) menu_id1 = map1.get("menu_id").toString();
										if(map1.get("menu_name")!=null) menu_name1 = map1.get("menu_name").toString();
										if(map1.get("up_menu_id")!=null) up_menu_id1 = map1.get("up_menu_id").toString();
										if(map1.get("rsrv_str1")!=null) {
											remark1 = map1.get("rsrv_str1").toString();
											if(remark1!=null&&remark1.length()>50)
												remark1=remark1.substring(0,50)+"...";
										}
										filterMap.put(menu_id1,menu_name1);
										String module_path1 = menu.getModuleFile(menu_id1);
										module_path1 = module_path1.replace("WebRoot/","");
								if(!filterMap.containsKey(menu_id1)){
								
									  %>
				
							
								<tr style="line-height:20px;">
									
								  	<td width="20%">
								  		<%if(module_path1==null||module_path1.equals("")){%>
								  			<a href="#" >
								  		<%} else{%>
								  			<a href="<%=module_path1%>?menu_id=<%=menu_id1%>" target="main">
								  		<%}%>
									  	
									  	<%=menu_name1%></a>
								  	</td>
								  	<td width="20%"><%=menuInfo.getMenuNameById(up_menu_id1)%></td>
									<td ><%=remark1 %></td>
								</tr>
							
						
						  <%
						  }
				  			Map params2=new Hashtable();
							params2.put("subsys_code","SYS");
							params2.put("cust_id",cust_id);
							params2.put("up_menu_id",menu_id1);
							params2.put("menu_class","3");
							
							threeList=menuInfo.getMenuInfo(params2);
							if(threeList!=null&&threeList.size()>0){
								for(int k=0;k<threeList.size();k++){
									Hashtable map2 = (Hashtable)threeList.get(k);
									//out.print("map2="+map2);
						  			String menu_id2="",menu_name2="",up_menu_id2="",remark2="";
						  			  	if(map2.get("menu_id")!=null) menu_id2 = map2.get("menu_id").toString();
										if(map2.get("menu_name")!=null) menu_name2 = map2.get("menu_name").toString();
										if(map2.get("up_menu_id")!=null) up_menu_id2 = map2.get("up_menu_id").toString();
										if(map2.get("rsrv_str1")!=null) {
											remark1 = map2.get("rsrv_str1").toString();
											if(remark1!=null&&remark1.length()>50)
												remark1=remark1.substring(0,50)+"...";
										}
										filterMap.put(menu_id2,menu_name2);
										String module_path2 = menu.getModuleFile(menu_id2);
										module_path2 = module_path2.replace("WebRoot/","");
							
									if(!filterMap.containsKey(menu_id2)){
									  %>
									  	<tr style="line-height:20px;">
										<td width="20%">
								  		<%if(module_path2==null||module_path2.equals("")){%>
								  			<a href="#" >
								  		<%} else{%>
								  			<a href="<%=module_path2%>?menu_id=<%=menu_id2%>" target="main">
								  		<%}%>
									  	
									  	<%=menu_name2%></a>
								  	</td>
								  	<td width="20%"><%=menuInfo.getMenuNameById(up_menu_id2)%></td>
									<td ><%=remark2 %></td>
								</tr>
						
						  <%}	}
						  }
						 			 }
								}
							  }
				  %>
		
	</table>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0" class="dl_bg">
		<tr>
			<td width="90%">
			</td>
			<td>
			</td>
		</tr>
	</table>
	<table width="100%" cellpadding="0" cellspacing="0" border="0"  class="tablehe">
		<tr><td align="center"></td></tr>
	</table>
	
	<%
		 }
	%>
	
	  <input type="hidden" name="menuListsize" id="menuListsize" value="<%=menuListsize %>" />
	  <input type="hidden" name="pkid" id="pkid" value="" />
	  <input type="hidden" name="bpm_id" id="bpm_id" value="2486" />
	  </form>
</body>

</html>
